file = open(URI.parse('http://static.galileo.xiaojukeji.com/static/tms/seller_avatar_256px.jpg'))
restaurant  = Restaurant.find_or_create_by(name: '测试店铺',login:'15828050106',description:'测试信息',bulletion:'粥品香坊其烹饪粥料的秘方源于中国千年古法，在融和现代制作工艺，由世界烹饪大师屈浩先生领衔研发。坚守纯天然、0添加的良心品质深得消费者青睐，发展至今成为粥类的引领品牌。是2008年奥运会和2013年园博会指定餐饮服务商。"
')
restaurant.attachment = file
restaurant.password = '123456'
restaurant.save

food_type_1 = FoodType.find_or_create_by(name:"特色菜",is_top:true,restaurant_id: restaurant.id)
food_type_2 = FoodType.find_or_create_by(name:"炒菜",restaurant_id: restaurant.id)
food_type_3 = FoodType.find_or_create_by(name:"烧菜",restaurant_id: restaurant.id)

food1 = Food.find_or_create_by(name:"皮蛋瘦肉粥",show_price:20,sell_price:15,description:'一碗皮蛋瘦肉粥，总是我到粥店时的不二之选。香浓软滑，饱腹暖心，皮蛋的Q弹与瘦肉的滑嫩伴着粥香溢于满口，让人喝这样的一碗粥也觉得心满意足',food_type_id:food_type_1.id)
food1.attachment = open(URI.parse('http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg'))
food1.save

food2 = Food.find_or_create_by(name:"扁豆焖面",show_price:32,sell_price:14,food_type_id:food_type_1.id,description:'')
food2.attachment = open(URI.parse('http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg'))
food2.save

food3 = Food.find_or_create_by(name:"葱花饼",show_price:15,sell_price:10,food_type_id:food_type_1.id,description:'')
food3.attachment = open(URI.parse('http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg'))
food3.save

food4 = Food.find_or_create_by(name:"牛肉馅饼",show_price:17,sell_price:14,food_type_id:food_type_2.id,description:'')
food4.attachment = open(URI.parse('http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg'))
food4.save

food5 = Food.find_or_create_by(name:"招牌猪肉白菜锅贴",show_price:18,sell_price:15,food_type_id:food_type_2.id,description:'')
food5.attachment = open(URI.parse('http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg'))
food5.save

food6 = Food.find_or_create_by(name:"红豆薏米美肤粥",show_price:20,sell_price:15,food_type_id:food_type_2.id,description:'')
food6.attachment = open(URI.parse('http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg'))
food6.save

food7 = Food.find_or_create_by(name:"八宝酱菜",show_price:22,sell_price:15,food_type_id:food_type_3.id,description: '')
food7.attachment = open(URI.parse('http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg'))
food7.save

drink = Food.find_or_create_by(name: '白酒',show_price:22,sell_price:15,description:'')
drink.attachment = open(URI.parse('http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg'))
drink.save

Drink.find_or_create_by(food_id:drink,restaurant_id:restaurant.id)
DiscountSetting.find_or_create_by(restaurant_id:restaurant.id)
DiscountFood.find_or_create_by(food_id: food1.id,restaurant_id:restaurant.id)
DiscountFood.find_or_create_by(food_id: food2.id,restaurant_id:restaurant.id)

group = FoodGroup.find_or_create_by(restaurant_id:restaurant.id,name: '测试套餐',price:20)
group.attachment = open(URI.parse('http://fuss10.elemecdn.com/e/c6/f348e811772016ae24e968238bcbfjpeg.jpeg'))
group.save

FoodGroupItem.find_or_create_by(food_id:food1.id,food_group_id:group.id)
FoodGroupItem.find_or_create_by(food_id:food4.id,food_group_id:group.id)
FoodGroupItem.find_or_create_by(food_id:drink.id,food_group_id:group.id)






